<include file="public+header">

   <!-- 标题  -->
   <div class="title"><lang>数据库备份文件列表</lang> ( <a href="{:G::U('backup/index')}"><lang>数据库备份</lang></a> | <a href="{:G::U('backup/runsql')}"><lang>运行SQL语句</lang></a> | <a href="{:G::U('backup/optimize')}"><lang>数据库优化</lang></a> )</div>

   <if condition="!empty( $sWarning )"><div id="content_warning">{$sWarning}</div></if>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="{:G::U('backup/upload_sql')}" method="post" id="upload_sql" enctype="multipart/form-data" name="upload_sql" >
      <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><lang>本地上传恢复备份</lang></label></td>
              <td><input type="file" name="sqlfile" size="50" class="field" >
              <div class="description"><lang>你可以直接导入本地sql文件进行数据恢复</lang></div></td>
            </tr>

       </table>
       <p class="center">
          <input type="button"  class="button" value=" <lang>上传并执行sql语句</lang>  " onclick="importFileConfrim()" />
          <input type="reset" class="button" value="  <lang>重  置</lang>  " />
        </p>
        </form>
        <br/>
      <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><lang>服务器备份文件管理</lang> </label></td>
              <td><div class="description"><lang>你可以使用服务器中的备份文件进行数据恢复</lang></div></td>
            </tr>

      </table>
      <form action="{:G::U('backup/remove')}" method="post" id="sqlList" name="sqlList" >
      <table class="data full" id="checkList">
        <thead>
        <tr>
           <th width="5px"><input onclick="CheckAll('checkList')" type="checkbox"></th>
           <th><lang>文件名</lang></th>
           <th><lang>时间</lang></th>
           <th><lang>大小</lang></th>
           <th><lang>卷</lang></th>
           <th><lang>操作</lang></th>
        </tr>
        </thead>
        <tbody>
        <foreach for=arrList>
        <tr {if $value['mark'] == 2}style="display:none;"{/if}>
           <td><input type="checkbox" name="file[]" value="{$value['name']}" /></td>
           <td>{if $value['mark'] == 1}<img onClick="rowClick(this)" src="__TMPLPUB__/Images/menu_plus.gif" >
           {elseif $value['mark'] == 2}<img src="__TMPLPUB__/Images/menu_arrow.gif">{/if}<a href="__APPPUB__/Backup/{$value['name']}">{$value['name']}</a></td>
           <td>{$value['add_time']}</td>
           <td>{$value['file_size']}</td>
           <td>vol:{$value['vol']}</td>
           <td align="center">{if $value['mark'] == 1 || $value['mark']=='0'}<a href="{:G::U('backup/import?file_name='.$value['name'])}">[导入]</a>{d*else}&nbsp;{/if}</td>
           </tr>
         </foreach>
        </tbody>
        </table>
        <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><lang>备份操作</lang> </label></td>
              <td><input type="button" value="  <lang>删除备份文件</lang>   " class="button" onclick="deleteFileConfrim()"/>
              <div class="description"><lang>你可以对备份文件进行操作，备份文件一旦被删除，不能够被恢复</lang></div></td>
            </tr>

      </table>
      </form>

{script}
function importFileConfrim(){

	dyhbConfirm( D.L( '你确定要导入选中数据吗？' ),function( dialogInstance ){

       dialogInstance.DispatchEvent("onaccept") && dialogInstance.close();
       Dyhb.Dom.$( 'upload_sql').submit();
	} );
}

function deleteFileConfrim(){

    dyhbConfirm( D.L( '你确定要删除选中数据吗？' ),function( dialogInstance ){

       dialogInstance.DispatchEvent("onaccept") && dialogInstance.close();
	   Dyhb.Dom.$( 'sqlList').submit();
	} );
}

function rowClick(obj){

  var row = obj.parentNode.parentNode;
  var tbl = row.parentNode.parentNode;
  var test = false;
  var img = '';

  if (obj.src.substr(obj.src.lastIndexOf('/') + 1) == "menu_minus.gif")
  obj.src = "__TMPLPUB__/Images/menu_plus.gif";
  else
  obj.src = "__TMPLPUB__/Images/menu_minus.gif";

  for (i = 0; i < tbl.rows.length; i++){

    var cell = tbl.rows[i].cells[1];

    if (cell && cell.childNodes[0].src){

      img = cell.childNodes[0].src.substr(cell.childNodes[0].src.lastIndexOf('/') + 1);
    }

    else{

      img = '';
    }

    if (test && img){

      if (img == "menu_arrow.gif"){

        tbl.rows[i].style.display = tbl.rows[i].style.display != 'none' ? 'none' :(Dyhb.Browser.Ie) ? 'block' : 'table-row';
      }

      else{

        test=false;
      }
    }

    if (tbl.rows[i] == row){

      test = true;
    }
  }

}

//-->
{/script}
   </div>
   <!-- end content -->

<include file="public+footer">